﻿//-----------------------------------------------------------------------
// <copyright file="Copyright.cs" author="Michael Herndon">
//     Copyright (c) CompanyName.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Amplify.Twitter
{
	#region Using Statements
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;

	using MbUnit.Framework;

	using Describe = MbUnit.Framework.TestsOnAttribute;
	using InContext = MbUnit.Framework.DescriptionAttribute;
	using It = MbUnit.Framework.TestAttribute;
	using Should = MbUnit.Framework.DescriptionAttribute;
	using By = MbUnit.Framework.AuthorAttribute;
	using Tag = MbUnit.Framework.CategoryAttribute;
	#endregion

	[
		Describe(typeof(FriendshipClient)),
		InContext("should perform its specified behavor."),
		Tag("Functional"),
		Ignore,
		By("Michael Herndon", "mherndon@opensourceconnections.com", "www.amptools.net")
	]
	public class FriendshipClientSpec : Spec
	{

		[It, Should(" determine if a user is a friend, destroy that friendship, then recreated it. ")]
		public void DetermineExistenceAndCreateThenDestroy()
		{
			UserClient userService = Twitter.CreateUserClient();
			User[] friends = userService.GetFriends();

			friends.ShouldNotBeNull();
			friends.Length.ShouldBeGreaterThan(0);

			FriendshipClient client = Twitter.CreateFriendshipClient();

			bool exists = client.DetermineIfExists(AssemblyFixture.Username, friends[0].Screename).Friends;
			exists.ShouldNotBeNull();
			exists.ShouldBeTrue();

			User friend =	client.Destroy(friends[0].Screename);
			friend.ShouldNotBeNull();
			friend.Screename.ShouldBe(friends[0].Screename);

			friend = client.Create(friend.Screename);

			friend.ShouldNotBeNull();
			friend.Screename.ShouldBe(friends[0].Screename);

		}
	}
}
